/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package csm.uttils;

/**
 *
 * @author Carlos S. Moreno <CarlosS.Moreno@gmail.com>
 */
public class Validation {

    /**
     * Valid if the String is a Well Formated Integer.
     * @param num String to validate
     * @return True if it can be formated as an Integer
     */
    public static boolean isAValidInt(String num)
    {
        try
        {
            Integer.parseInt(num);
        }
        catch (NumberFormatException e)
        {
            return false;
        }
        return true;
    }

    /**
     * Valid if the String is a Well Formated Double.
     * @param num String to validate
     * @return True if it can be formated as an Double
     */
    public static boolean isAValidDouble(String num)
    {
        try
        {
            Double.parseDouble(num);
        }
        catch (NumberFormatException e)
        {
            return false;
        }
        return true;
    }

    /**
     * Valid if the String is a Well Formated Float.
     * @param num String to validate
     * @return True if it can be formated as an Float
     */
    public static boolean isAValidFloat(String num)
    {
        try
        {
            Float.parseFloat(num);
        }
        catch (NumberFormatException e)
        {
            return false;
        }
        return true;
    }

}
